<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:ui="http://java.sun.com/jsf/facelets"
	  xmlns:h="http://java.sun.com/jsf/html"
	  xmlns:f="http://java.sun.com/jsf/core">
	<head><title>IGNORED</title></head>
    <body>
		<ui:composition template="../templates/layout.xhtml">
			<ui:define name="windowTitle">Daily Market | Administrator Console | Manage Clients</ui:define>
			<ui:define name="logoImage"><h:graphicImage library="images" name="logo_header.jpg" alt="logo" /></ui:define>
			<ui:define name="content">
				<div id="content" class="graphic_bg">
					<h:form>
						<div class="form-row header">Manage Clients
							<h:commandLink action="#{userListBean.doCreateNewClient}" styleClass="image-button no-height" style="float: right;">
								<h:graphicImage library="images/icons/16" name="add.png" styleClass="with-text" alt="a" title="Add New Client" />New Client
							</h:commandLink>
						</div>
					</h:form>
					<h:messages globalOnly="true" styleClass="form-messages" fatalClass="form-messages error" errorClass="form-messages error" warnClass="form-messages warn" infoClass="form-messages good" />
					<h:form>
						<h:dataTable value="#{userListBean.clientList}" var="curUser" rendered="#{userListBean.clients}" style="margin-top: 5px; border: solid 4px #FFFFFF; border-collapse: collapse;" rowClasses="odd-row, even-row" headerClass="header-row" columnClasses="id-col,data-col,data-col,tools-col" >
							<h:column>
								<f:facet name="header">
									<h:outputText value="User ID" />
								</f:facet>
								<h:outputText value="#{curUser.clientID}" />
							</h:column>
							<h:column>
								<f:facet name="header">
									<h:outputText value="Password" />
								</f:facet>
								<h:inputText value="#{curUser.password}" rendered="#{curUser.editable}" size="20"/>
								<h:outputText value="Click Edit to View" rendered="#{not curUser.editable}" style="font-style: italic;" />
							</h:column>
							<h:column>
								<f:facet name="header">
									<h:outputText value="Client Type" />
								</f:facet>
								<h:selectOneMenu value="#{curUser.clientType}" rendered="#{curUser.editable}">
									<f:selectItem itemValue="#{curUser.clientTypeAdmin}" itemLabel="Administrator" />
									<f:selectItem itemValue="#{curUser.clientTypePartner}" itemLabel="Partner" />
									<f:selectItem itemValue="#{curUser.clientTypeCustomer}" itemLabel="Customer" />
								</h:selectOneMenu>
								<h:outputText value="#{curUser.userProfile.clientTypeDisplay}" rendered="#{not curUser.editable}" />
							</h:column>
							<h:column>
								<h:commandLink action="#{userListBean.doCommitEditClient(curUser)}" rendered="#{curUser.editable}">
									<h:graphicImage library="images/icons/32" name="accept.png" alt="a" title="Save" />
								</h:commandLink>
								<h:commandLink action="#{userListBean.doCancelEditClient}" rendered="#{curUser.editable}">
									<h:graphicImage library="images/icons/32" name="cancel.png" alt="c" title="Cancel" />
								</h:commandLink>
								<h:commandLink action="#{userListBean.doEditClient(curUser)}" rendered="#{not curUser.editable}" >
									<h:graphicImage library="images/icons/32" name="user_edit.png" alt="e" title="Edit User" />
								</h:commandLink>
								<h:commandLink action="#{userListBean.doAdvancedEditClient(curUser)}">
									<h:graphicImage library="images/icons/32" name="page_edit.png" alt="e" title="Edit Profile" />
								</h:commandLink>
								<a href="Javascript:;" onclick="do_confirm_delete_client('#{curUser.clientID}')" >
									<h:graphicImage library="images/icons/32" name="user_delete.png" alt="d" title="Delete User" />
								</a>
								<h:commandLink action="#{userListBean.doDeleteClient(curUser)}" id="delete-user" styleClass="del-client-command" title="#{curUser.clientID}" style="display: none; visibility: hidden;" />
							</h:column>
						</h:dataTable>
						<h:outputText styleClass="message warn" rendered="#{not userListBean.clientsExist}" value="There are no users!" />
					</h:form>
				</div>
			</ui:define>
		</ui:composition>
	</body>
</html>
